<%-------------------------------------------------------------------
 * 页面名称：netBankInpour_1.jsp
 * 功能描述：网上银行充值－选择银行
 * Action  : netBankInpour
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
%>
<script type='text/javascript' src='<%=path%>/js/ufront.js'></script>
<script type='text/javascript'
	src='<%=path%>/dwr/interface/accountTemplate.js'></script>
<script type='text/javascript'
	src='<%=path%>/js/vnv/commonForCnAmount.js'></script>
<script type='text/javascript' src='<%=path%>/js/vnv/tomoney.js'></script>
<script language="JavaScript" type="text/JavaScript">
	function getRadioValue(radioObject){
		if(radioObject.length==undefined){
			if(radioObject.checked) return radioObject.value;
		}else{
			for(var i=0;i<radioObject.length;i++){
				if(radioObject[i].checked) return radioObject[i].value;
			}
		}
		return undefined;
	}
	function prepareParameters(){
		var bankId = getRadioValue(document.NetBankInpourForm.bank);
		if(bankId == undefined){
			return false;
		}
		document.NetBankInpourForm.bankId.value = bankId;
		return true;
	}
	function submitProcess() {
		var amount=document.getElementsByName("amount")[0].value;
		accountTemplate.confirmToRuleByInpour(amount,show);
	}
	function show(data)
	{
		var formObj = document.NetBankInpourForm;
		if(checkNecessaryInput(formObj)){
			if(!prepareParameters()){
				alert("请选择网上银行！");
				return false;
			}
		}
	if("66"==data){
	   alert("违反单笔充值限额");
	   return;
	}
	if("67"==data){
	   alert("违反每日充值限额");
	   return;
	}
	if("68"==data){
	   alert("违反每月充值限额");
	   return;
	}
	if("75"==data){
	   alert("违反账户余额上限");
	   return;
	}
	
		formObj.submit();	
	}
	
	var bankInfoPicUrl = "<%=path%>/images/bank/";
	function showBankInfo(radioObj,bankcode) {
	<logic:equal name="sessionAccountSummary" property="account.accountType" value="A">
		if (radioObj.checked) {
			document.getElementById("bankInfoPic").src = bankInfoPicUrl+bankcode+".gif";
			document.getElementById("bankInfo").style.display = "";
		}
	</logic:equal>
	}
	function kd(){
		var ss=getObj("amount").value;
		ss = ss.replace(/ /g,"");
		if (ss=="") {
			getObj("upperAmount").value="";
			return;
		}
		
		var sDispMsg = getChineseCurrencyString(ss);
		if(sDispMsg==-1) sDispMsg="错误的金额!";
		if(sDispMsg==-2) sDispMsg="太长的金额!";
		getObj("upperAmount").value=sDispMsg;
	}
	function updatePrompt(data) {
	}
	function amountBlur(objAmount) {
		// 金额失去焦点方法
		if(checkDecimalInput(objAmount,0)) {
			accountTemplate.ifAccountIsEffect(objAmount.value, updatePrompt);
		}
		tomoney('NetBankInpourForm','amount','hideTransAmt');
		kd();
	}

	function selectBank(bankCode) {
		// 点击银行图片选择银行方法
		document.getElementById("check_" + bankCode).checked = true;
		showBankInfo(document.getElementById("check_" + bankCode),bankCode);
	}
</script>
<div id="main">
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				网上银行充值
			</div>
			<div class="edit_pass">
				<html:form method="post" action="netBankInpour">
					<html:hidden property="bankId" />
					<html:hidden property="step" />
					<html:hidden property="actionType" />
					<table width="100%" border="0" align="center" cellpadding="5"
						cellspacing="1">
						<tr>
							<td width="23%" align="right" height="35px;">
								充值子账户：
							</td>
							<td width="77%" height="35px;">
								<html:select property="subAccountId">
									<html:options collection="subAccounts" property="accountId"
										labelProperty="accountName" />
								</html:select>
							</td>
						</tr>
						<tr>
							<td align="right" height="35px;">
								<span class="orang12b">*</span> 充值金额：
							</td>
							<td height="35px;">
								<html:text property="amount" alt="充值金额" styleClass="inputStyle"
									onblur="amountBlur(this);" onkeyup="kd();" onchange="kd();" />
								元 &nbsp;&nbsp;
								<img src="<%=path%>/images/money.gif" width="17" height="17"
									style="cursor:hand" title="请使用计算器，计算充值金额"
									onclick="amountSelect();" />
								<input type="hidden" name="hideTransAmt" value="" />
							</td>
						</tr>
						<tr>
							<td align="right" height="35px;">
								充值金额大写：
							</td>
							<td height="35px;">
								<input name="upperAmount" type="text" class="inputStyleNoborder"
									size="50" style="background:#F6F6F6;" readonly />
							</td>
						</tr>
						<tr>
							<td align="right" valign="top" height="35px;">
								<span class="orang12b">*</span> 请选择要使用的网上银行：
							</td>
							<td height="35px;">
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<c:forEach var="bank" items="${BankList}" varStatus="status">
										<c:if test="${status.index % 3 == 0}">
											<tr>
										</c:if>
										<td width="5%">
											<label>
												<input type="radio" style="border:0;" name="bank"
													id="check_<c:out value="${bank.linkCode}"/>"
													value="<c:out value="${bank.id}"/>"
													onclick="javascript:showBankInfo(this,'<c:out value="${bank.linkCode}"/>');" />
											</label>
										</td>
										<td width="45%">
											<a
												href="javascript:selectBank('<c:out value="${bank.linkCode}"/>')">
												<img alt="<c:out value="${bank.bankName}"/>" border="0"
													src="<%=path%>/images/bank/logo/logo_<c:out value="${bank.linkCode}"/>.gif" />
											</a>
										</td>
										<c:if test="${status.index % 3 == 2}">
											</tr>
										</c:if>
										<c:if test="${status.last && status.count % 3 == 2}">
											<td></td>
											</tr>
										</c:if>
									</c:forEach>
								</table>
							</td>
						</tr>
						<tr>
							<td height="55" align="right">
								&nbsp;
							</td>

							<td bgcolor="#FFFFFF">
								<input name="next" type="button" class="button_style"
									onclick="submitProcess();" value="下一步" />
							</td>
						</tr>
						<tr id="bankInfo" style="display:none">
							<td align="center" bgcolor="#FFFFFF">
								&nbsp;
							</td>
							<td>
								<img id="bankInfoPic" src="" border="0" />
							</td>
						</tr>
						<tr>
							<td height="55" align="right">
								&nbsp;
							</td>
							<td class="twoSiderLine">
								&nbsp;
								<font color="#FF0000"><html:errors /> </font>
							</td>
						</tr>
					</table>
				</html:form>
				<table width="100%" border="0" align="center" cellpadding="7"
					cellspacing="1" bgcolor="#f9e277" style="margin:10px 0;">
					<tr>
						<td bgcolor="#fffdf5">
							<table width="100%" border="0" cellpadding="3" cellspacing="0">
								<tr>
									<td width="3%" height="25" valign="top"
										style="border-bottom:1px solid #ccc;"></td>
									<td width="97%" align="left" class="red12b"
										style="border-bottom:1px solid #ccc;">
										特别提醒
									</td>
								</tr>
								<tr>
									<td valign="top">
										&nbsp;
									</td>
									<td align="left" class="font_gray">
										您需要先开通网上银行支付服务，才可以进行&quot; 网上银行充值&quot;。如果您还没开通，请点击
										<a target="_blank"
											href="<%=path%>/page/help/how_openoutBank.html"
											class="bluefont12u">查看如何开通</a> 或访问各银行的网上银行查看申请流程。
									</td>
								</tr>
								<tr>
									<td valign="top">
										&nbsp;
									</td>
									<td align="left" class="font_gray">
										如果您使用的浏览器具有
										<span class="redColor12px">阻止弹出窗口功能</span>，请先将您要使用的网上银行的地址加入浏览器的允许弹出窗口列表中，否则
										可能您的银行卡资金已经支出，但您的天下付账户无法收到充值金额。请点击
										<a href="<%=path%>/page/help/SetWindow.jsp" target="_blank"
											class="bluefont12u">查看如何设置</a>
									</td>
								</tr>
								<tr>
									<td valign="top">
										&nbsp;
									</td>
									<td align="left" class="font_gray">
										天下付账户 不允许进行虚假交易、银行卡转账套现或洗钱等被禁止的交易行为，否则充值款项将不能提现。
										</a>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript" src="<%=path%>/js/layer.js"></script>
<script language="JavaScript" type="text/JavaScript">
function closeLayer(returnValue, type){
	hideLayer();
	if(type=="amount"){
		document.NetBankInpourForm.amount.value=returnValue;
		document.NetBankInpourForm.amount.focus();
		kd();
	}
}

function amountSelect(){
 	agiledata.getUserInternal(amountPopup);
}
function amountPopup(data) {
  	if(data) {
	 	openLayer("<%=path%>/page/common/simpleCalculator.jsp",400,200,false);
	} else {
		location.href="<%=path%>/page/util/session_invalid.jsp";
	}      
}

//显示预先设置的金额的大写
kd();

//显示预先选择的银行
if (document.NetBankInpourForm.bank.length==undefined) {
	if (document.NetBankInpourForm.bank.value==document.NetBankInpourForm.bankId.value) {
		document.NetBankInpourForm.bank.click();
	}
} else {
	for (var i=0; i<document.NetBankInpourForm.bank.length; i++) {
		if (document.NetBankInpourForm.bank[i].value==document.NetBankInpourForm.bankId.value) {
			document.NetBankInpourForm.bank[i].click();
			i = document.NetBankInpourForm.bank.length;
		}
	}
}

</script>
